package cn.xspace.module.other.activity.share;

import android.content.ClipboardManager;
import android.os.Bundle;

import com.xspace.android.xafcommon.base.BaseActivity;
import com.xspace.android.xafcommon.util.Constants;
import com.xspace.android.xafcommon.util.LogUtil;
import com.xspace.android.xafcommon.util.RequestConstant;
import com.xspace.android.xafcommon.view.DialogSetTextSize;
import com.xspace.android.xafcommon.view.dialog.WebViewMoreDialog;
import cn.xspace.module.other.R;

import cn.xspace.module.other.fragment.WnxWebViewFragment;

public class WnxWebViewAct extends BaseActivity {

    private static final String TAG = WnxWebViewAct.class.getSimpleName();
    public static final String PARAM_CONTENT = "param_content";


    private String tempUrl;
    private int type = -1;
    private String mTitle = "";
    private String mContent = "";
    private String org_id = "";
    private boolean showCollection = true; //是否显示收藏.默认显示
    private boolean showMore = true; //是否显示右上角更过按钮,末日呢显示

    protected ClipboardManager clipboard;
    private WebViewMoreDialog dialog;
    private DialogSetTextSize.Builder setTextSize;

    private String WEB_VIEW_INDEX = "webViewIndex";
    private int index;
    private int tempIndex;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment);
        Bundle mBundle = new Bundle();
        mBundle.putString(Constants.WEBVIEURL, tempUrl);
        mBundle.putString(Constants.TITITL, mTitle);
        mBundle.putInt("type", type);
        mBundle.putBoolean("Collection", showCollection);
        mBundle.putBoolean("showMore", showMore);
        mBundle.putString(PARAM_CONTENT, mContent);
        mBundle.putString(RequestConstant.KEY_ORG_ID, org_id);
        getSupportFragmentManager().beginTransaction().add(R.id.container, WnxWebViewFragment.newInstance(mBundle)).commit();

    }

    @Override
    protected void getIntentData() {
        tempUrl = getIntent().getStringExtra(Constants.WEBVIEURL);
        //屏幕方向,默认竖屏
//        screenOrientation = getIntent().getIntExtra("screenOrientation", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        type = getIntent().getIntExtra("type", -1);
        showCollection = getIntent().getBooleanExtra("Collection", true); //是否显示收藏,默认显示
        showMore = getIntent().getBooleanExtra("showMore", true); //是否显示收藏,默认显示
        mTitle = getIntent().getStringExtra(Constants.TITITL);
        mContent = getIntent().getStringExtra(PARAM_CONTENT);
        org_id = getIntent().getStringExtra(RequestConstant.KEY_ORG_ID);
        //收藏时使用,微农信收藏时将org_id赋值给depid,用于查询机构时使用
//        msg_deptid = org_id; //从收藏夹进入时无法在点击收藏,不需要传递该字段了
        LogUtil.d(TAG, "wubaojie>>>getIntentData: mTitle :" + mTitle + " mContent:" + mContent + " type : " + type +
                " tempUrl:" + tempUrl);


    }

    @Override
    protected void initView() {
        setContentView(R.layout.web_view_activity);
    }
}
